<template>
  <div v-if="closeBand" class="dialog-overlay">
    <div class="dialog-content" :style="{width:width}">
      <div class="dialog-header">
        <h2 class="dialog-title">{{ title }}</h2>
        <button class="announce-close-button" @click="close">✖</button>
      </div>
      <div class="dialog-slot">
        <slot/> <!-- 插槽用于插入内容 -->
      </div>
    </div>
  </div>
<!--  暂停使用-->
</template>

<script>
import { defineComponent } from 'vue';

export default defineComponent({
  props: {
    title: {
      type: String,
      default: '弹窗标题'
    },
    width: {
      type: String,
      default: '1000px'
    },
    closeBand: {
      type: Boolean,
      default: false
    }
  },

  methods: {
    close() {
      this.$store.state.announceDialog=false
      this.$store.state.warnDialog=false
    }
  }
});
</script>

<style scoped>
.dialog-overlay {
  background-color: rgba(31, 45, 61, 0.63);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.dialog-content {
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); /* 添加阴影 */
  overflow: hidden; /* 确保内容不溢出 */
}

.dialog-header {
  background: rgb(57, 88, 175);
  padding: 10px 20px;
  display: flex;
  align-items: center;
}

.dialog-title {
  color: #0a0a0a;
  margin: 0;
  flex-grow: 1; /* 允许标题占据剩余空间 */
}

.announce-close-button {
  background: transparent;
  border: none;
  color: #0a0a0a;
  font-size: 21px;
  cursor: pointer;
}

.dialog-slot {
  background-color: rgb(81, 111, 175);
  padding: 20px;
}
</style>
